import request from "@/utils/request";

// 登录方法
export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  }
  return request({
    url: '/login',
    headers: {
      isToken: false,
      repeatSubmit: false
    },
    method: 'post',
    data: data
  })

  // const result = {
  //   msg: "操作成功",
  //   code: 200,
  //   token:
  //     "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjgxYTE3NmE5LWI4OWQtNDQ5MC1iNDE3LTM1NjRiMzBhYTU1NiJ9.cOF7Obx55zn-_NzlYwRwm-zeOxD_CdA9Dy75Et1rQb5OPzKthHkdDPZuOkS_T55dx5UXdXu1TdD_LOCYwllSFw",
  // };
  // const promise = new Promise(function (resolve, reject) {
  //   resolve(result);
  // });
  // return promise;
}

// 注册方法
export function register(data) {
  return request({
    url: "/register",
    headers: {
      isToken: false,
    },
    method: "post",
    data: data,
  });
}

// 获取用户详细信息
export function getInfo() {
  return request({
    url: "/getInfo",
    method: "get",
  });
  // const result = {
  //   msg: "操作成功",
  //   code: 200,
  //   permissions: ["*:*:*"],
  //   roles: ["admin"],
  //   user: {
  //     createBy: "admin",
  //     createTime: "2023-04-23 16:11:38",
  //     updateBy: null,
  //     updateTime: null,
  //     remark: "管理员",
  //     userId: 1,
  //     deptId: 103,
  //     userName: "admin",
  //     nickName: "电力",
  //     email: "ry@163.com",
  //     phonenumber: "15888888888",
  //     sex: "1",
  //     avatar: "",
  //     password: "$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2",
  //     status: "0",
  //     delFlag: "0",
  //     loginIp: "111.181.87.32",
  //     loginDate: "2023-10-23T10:17:05.000+08:00",
  //     dept: {
  //       createBy: null,
  //       createTime: null,
  //       updateBy: null,
  //       updateTime: null,
  //       remark: null,
  //       deptId: 103,
  //       parentId: 101,
  //       ancestors: "0,100,101",
  //       deptName: "研发部门",
  //       orderNum: 1,
  //       leader: "电力",
  //       phone: null,
  //       email: null,
  //       status: "0",
  //       delFlag: null,
  //       parentName: null,
  //       children: [],
  //     },
  //     roles: [
  //       {
  //         createBy: null,
  //         createTime: null,
  //         updateBy: null,
  //         updateTime: null,
  //         remark: null,
  //         roleId: 1,
  //         roleName: "超级管理员",
  //         roleKey: "admin",
  //         roleSort: 1,
  //         dataScope: "1",
  //         menuCheckStrictly: false,
  //         deptCheckStrictly: false,
  //         status: "0",
  //         delFlag: null,
  //         flag: false,
  //         menuIds: null,
  //         deptIds: null,
  //         permissions: null,
  //         admin: true,
  //       },
  //     ],
  //     roleIds: null,
  //     postIds: null,
  //     roleId: null,
  //     admin: true,
  //   },
  // };
  // const promise = new Promise(function (resolve, reject) {
  //   resolve(result);
  // });
  // return promise;
}

// 退出方法
export function logout() {
  return request({
    url: "/logout",
    method: "post",
  });

  // const result = {
  //   msg: "操作成功",
  //   code: 200,
  // }
  // const promise = new Promise(function (resolve, reject) {
  //   resolve({
  //     data: result,
  //   });
  // });
  // return promise;
}

// 获取验证码
export function getCodeImg() {
  return request({
    url: "/captchaImage",
    headers: {
      isToken: false,
    },
    method: "get",
    timeout: 20000,
  });
  // const result = {
  //   msg: "操作成功",
  //   img: "/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAA8AKADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqK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jR7aIe2idV9jjLZ2irKRqowBXG/8Jbf/APPG2/75b/Gl/wCEv1D/AJ423/fLf/FUe2iHtonbBR6U4KK4j/hMNQ/542v/AHy3/wAVS/8ACZaj/wA8bX/vlv8A4qj20Q9tE7naCKYLZN2cCuK/4TPUf+eNr/3w3/xVL/wmupf88LT/AL4b/wCKo9tEPbRO8RcCpBXAf8JtqX/PC0/74b/4ql/4TjU/+eFp/wB8N/8AFUe2iHtonoIqrq//ACA9Q/69pP8A0E1xX/Cc6n/zwtP++G/+KqO58Z6jdWs1u8NqElRkYqrZAIxx81TKtGzFKrGzP//Z",
  //   code: 200,
  //   captchaEnabled: false,
  //   uuid: "c65b4b10fd53439d9d09db0c73818897",
  // };
  // const promise = new Promise(function (resolve, reject) {
  //   resolve(result);
  // });
  // return promise;
}
